#include <iostream>
#include <vector>

using namespace std; 

const int N = 1e5 + 10;

int n, st[N];
vector<int> edges[N];

void dfs(int u)
{
	cout << u << " ";
	st[u] = true;
	
	for(auto x : edges[u])
	{
		if(!st[x]) dfs(x);
	}
}

int main()
{
	cin >> n;
	for(int i = 1; i < n; i++)
	{
		int u, v; cin >> u >> v;
		edges[u].push_back(v);
		edges[v].push_back(u);
	}
	
	dfs(1);
	
	return 0;
}
